package com.facebook.julysfire;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class FirstAndroidActivity extends Activity 
{
    /** Called when the activity is first created. */
	
	int displayCounter = 0;
	Button add, subtract;
	TextView displayText;
	
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        displayCounter = 0;
        
        add = (Button) findViewById(R.id.buttonAdd);
        subtract = (Button) findViewById(R.id.buttonSubtract);
        displayText = (TextView) findViewById(R.id.textViewDisplay);
        
        add.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) 
			{
				// TODO Auto-generated method stub
				displayCounter++;
				displayText.setText("Your total is: " + displayCounter);
			}
		});
        
        subtract.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				displayCounter--;
				displayText.setText("Your total is: " + displayCounter);
			}
		});
    }
    
}